package com.qfmy.controller.novel;

import com.qfmy.service.novel.NovelAgentService;
import common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.qfmy.controller.novel
 * @date 2025/6/8
 * @description 智能小说
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/novelAgent")
public class NovelAgentController {

    /**
     * 注入service
     */
    @Autowired
    private NovelAgentService novelAgentService;

    /**
     * 智能搜书
     */
    @RequestMapping("/searchBook")
    public Result<String> searchBook(@RequestParam  String keyword) {
        return Result.ok(novelAgentService.searchBook(keyword));
    }

    /**
     * 清除缓存
     */
    @RequestMapping("/clearCache")
    public Result clearCache(){
        novelAgentService.clearCache();
        return Result.ok("清除缓存成功");
    }

}
